package a2022.a20221013;

import java.util.*;

/**
 * @author lenovo
 * @date 2022/10/14
 */
public class b {
    static int n = 100;

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        Map<Integer, List<String>> map = new HashMap<Integer, List<String>>();
        int T = scanner.nextInt();
        for (int i = 0; i < T; i++) {
            n = scanner.nextInt();
            int[] v = new int[n];
            for (int ai = 0; ai < n; ai++) {
                v[ai] = scanner.nextInt();
            }
            Arrays.parallelSort(v);
            int max = n;
            for (int ai = n - 1; ai > 0; ai--) {
                if (v[ai] < n - ai) {
                    max = n - ai - 1;
                    break;
                }
            }
            System.out.println(max);
        }
    }
}
